package com.atguigu.flink.chapter02_DataStreamAPI.simpletrans;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * Created by Smexy on 2022/10/22
 */
public class Demo5_Map
{
    public static void main(String[] args) {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStreamSource<Integer> source = env.fromElements(1, 2, 3);

        source.map(new MapFunction<Integer, String>()
        {
            @Override
            public String map(Integer value) throws Exception {
                return value + "是数字";
            }
        }).print();

        try {
                    env.execute();
                } catch (Exception e) {
                    e.printStackTrace();
                }

    }
}
